<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>公司修改页面</title>
		<script type="text/javascript" src="../../js/jquery-3.2.1.js"></script>
		<script type="text/javascript" src="../../js/bootstrap.js"></script>
		<link rel="stylesheet" href="../../css/bootstrap.css" />
		<script type="text/javascript" src="../../js/common.js"></script>
		<script type="text/javascript" src="../../js/company.js"></script>
		<link rel="stylesheet" href="../../css/common.css" />
	</head>

	<body>
		<!-- 这是修改页面,默认隐藏 -->
		<div class="modal fade" id="company-update-modal">
			<div class="modal-dialog">
				<div class="modal-content">
					<form class="form-horizontal" role="form">
						<div class="form-group" style="margin-top: 20px;">
							<label for="inputEmail3" class="col-sm-2 control-label">公司名称</label>
							<div class="col-sm-7">
								<input type="text" name="companyName" class="form-control" placeholder="公司名称" />
							</div>
							<input type="hidden" id="update-hidden" />
						</div>
						<div class="form-group" style="margin-top: 20px;">
							<label for="inputEmail3" class="col-sm-2 control-label">公司电话</label>
							<div class="col-sm-7">
								<input type="text" name="companyTel" class="form-control" placeholder="公司电话" />
							</div>
						</div>
						<div class="form-group" style="margin-top: 20px;">
							<label for="inputEmail3" class="col-sm-2 control-label">公司负责人</label>
							<div class="col-sm-7">
								<input type="text" name="companyManager" class="form-control" placeholder="公司负责人" />
							</div>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal" id="colse">关闭</button>
							<button type="button" class="btn btn-primary" id="company-update">保存</button>
						</div>
					</form>
				</div>
			</div>
		</div>

		<!-- 这是失败的页面，默认隐藏 -->
		<div class="modal fade" id="error" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="alert alert-danger alert-dismissable" id="error-message">
			</div>
		</div>

		<!-- 这是成功的页面，默认隐藏 -->
		<div class="modal fade" id="success" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="alert alert-success alert-dismissable" id="success-message">

			</div>
		</div>
	</body>
	<script>
		
		//填充修改方法开始
		$(function(){
			$('#company-update-modal').modal('show');
			var id = getParameter('id');
			$.ajax({
				type:"post",
				url: getPath() + "/company",
				data:({
					"method":"findById",
					"id":id,
				}),
				dataType: "json",
				success:function(jsonData){
					$(jsonData.data).each(function(index,data){
						//2.其他input赋值开始
						$('#update-hidden').val(data.id);
						$('input[name="companyTel"]').val(data.companyTel);
						$('input[name="companyManager"]').val(data.companyManager);
						$('input[name="companyName"]').val(data.companyName);
						//2.其他input赋值结束
					});
				}
			});
		});
		//填充修改方法结束
	</script>
</html>